package com.ie.controller.before;

import com.ie.common.http.ResponseResult;
import com.ie.common.security.anno.AuthIgrone;
import com.ie.entity.CartEntity;
import com.ie.entity.GoodsEntity;
import com.ie.service.admin.GoodsService;
import com.ie.service.before.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/before/cart")
public class CartController {
    @Autowired
    private CartService cartService;
    @Autowired
    private GoodsService goodsService;

    @AuthIgrone
    @PostMapping("/add")
    public ResponseResult<Map<String, Object>> addCart(@RequestBody CartEntity cartEntity) {
        return cartService.addCart(cartEntity);
    }

    @AuthIgrone
    @PostMapping("/update")
    public ResponseResult<Map<String, Object>> updateCart(@RequestBody CartEntity cartEntity) {
        return cartService.updateCart(cartEntity);
    }

    @AuthIgrone
    @PostMapping("/delete")
    public ResponseResult<Map<String, Object>> deleteCart(@RequestBody CartEntity cartEntity) {
        return cartService.deleteCart(cartEntity);
    }


}
